package wnco.base;

import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.Date;

public class MapFunctionW {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);
        DataStreamSource<SomData> dss = env.fromElements(
                new SomData("aa", 1, 496656L),
                new SomData("bb", 2, 745451L),
                new SomData("cc", 3, 351548L),
                new SomData("dd", 4, 126988L),
                new SomData("ee", 5, 984656L));
//        SingleOutputStreamOperator<String> map = dss.map(new MapFunction<SomData, String>() {
//            @Override
//            public String map(SomData value) throws Exception {
//                return value.getName();
//            }
//        });

        SingleOutputStreamOperator<String> map = dss.map((MapFunction<SomData, String>) SomData::getName);
        map.print();
        env.execute();
    }
}

